<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>constructor属性</title>
</head>

<body>
  <script>
    // ============================== constructor属性 ==============================
    // 1. constructor属性在原型对象里面
    // 2. constructor属性 指向原型对象的构造函数

    function Person(name) {
      this.name = name
    }


    // 3. 有什么使用场景呢？
    // Person.prototype.sing = function () {
    //   console.log('我会唱歌')
    // }
    // Person.prototype.dance = function () {
    //   console.log('我会跳舞')
    // }
    //  Person.prototype.learn=function(){
    //     console.log('我会好好学习')
    //  }
    // console.log(Person.prototype)


   //原型替换
    Person.prototype={
      constructor:Person,
      sing(){console.log('我会唱歌')},
      dance(){console.log('我会跳舞')},
      learn(){console.log('我会好好学习')}

    }

    console.log(Person.prototype)

  </script>
</body>

</html>